home *** CD-ROM | disk | FTP | other *** search
- /* origami.h - contains some definitions and a lot of prototypes */
-
- /*{{{}}}*/
- /*{{{ includes*/
- #include "default.h"
- #include <h/os.h>
- #include <lib/ori_bool.h>
- /*{{{ h/keys.h*/
- #if defined(GETTK_C) || defined(I_GETTK_C)
- # define BIND_CONST
- #endif
- #include <h/keys.h>
- #if defined(GETTK_C) || defined(I_GETTK_C)
- # undef BIND_CONST
- #endif
- /*}}} */
- #include <h/lg.h>
- #include "exit.h"
- #include <h/getmsg.h>
- /*}}} */
-
- #define private static
- #define public
-
- /*{{{ constants*/
- /*{{{ shifting lines*/
- #ifdef LOOP_C
- # define SHIFT_PART(width) (((width)/8)+1)
- #endif
- /*}}} */
- /*{{{ status line length*/
- #ifdef DISPLAY_C
- # ifdef WINDOW_TITLE_CHANGE
- # define WIN_TITLE_LENGTH(w) (((w)*3)/4)
- # endif
- #endif
- #ifdef LOOP_C
- # define MIN_SG_TITLE 8
- #endif
- /*}}} */
- /*{{{ terminal i/o*/
- #ifdef SCREEN_C
- # define M_RP_LIMIT 8 /* use rp, if > M_PUT_LIMIT chars */
- # define M_DIR_RP_LIMIT 16 /* simulate rp ' ' by DC/IC */
- #endif
- #ifdef USE_SCRBUFF
- # ifdef SCRBUFF_C
- # define SCROLL_INVERSE(wx,ws) ((wx)>(9*(ws))/16)
- /* scroll remaining, if wide enough */
- # define FL_SHIFT_OVER 8 /* skip more equal chars, no printing */
- # define FL_SHIFT_MAX 6 /* maximum number of chars to shift */
- # define FL_SHIFT_SCALE 8 /* diff_lg/FL_SHIFT_SCALE= */
- /* max shift width for given diff len */
- # define FL_NO_DL_AL(out,height) ((out)>(((height)*3)/4))
- /* to many new lines -> no al/dl usage */
- # define FL_MAX_AL_DL 16 /* up to FL_MAX_AL_DL lines added/deleted */
- /* in one step */
- # endif
- # ifdef GETTK_C
- # define ARG_FL_COUNT 64 /* number of rep-arg's for auto flushs */
- # endif
- #endif
- #define DEF_CURSOR_LINE 4 /* default y-screen-position */
- /*}}} */
- /*{{{ length of internal text/filename buffers*/
- #define BUFFERLEN ((_POSIX_PATH_MAX>LINELEN)?_POSIX_PATH_MAX:LINELEN)
- /*}}} */
- /*}}} */
- /*{{{ types*/
- /*{{{ language*/
- /*{{{ f_c_types*/
- typedef enum
- { F_C_NONE=0,
- LANGTYP
- F_C_USER,
- F_C_TDS, /* this has to be the last defined language!!! */
- F_C_SIZE
- } f_c_types;
- /*}}} */
- /*{{{ language_comment*/
- typedef struct
- { struct
- { unsigned char *start;
- unsigned char *end;
- } txt;
- struct dia_lg
- { int start;
- int end;
- } lg;
- unsigned char *name;
- } language_comment;
- /*}}} */
- /*}}} */
- /*{{{ fold-tags*/
- typedef enum
- { NOT_FOLD =1,
- START_FILED =2,
- START_FOLD =4,
- END_FOLD =8,
- START_OPEN_FOLD =16,
- START_ENTER_FILED =32,
- START_ENTER_FOLD =64
- } linetyp;
- #define FOLD_BITS 8
- #define FOLD_MASK ((1<<FOLD_BITS)-1)
- /*}}} */
- /*{{{ element*/
- /*{{{ fold data*/
- typedef struct
- { struct element *data, *other_end;
- int close_line;
- union
- { struct
- { unsigned char type;
- unsigned char contents;
- int indent;
- } U1;
- struct
- { int old_line;
- boolean v_mode;
- } U0;
- } UU;
- } fold_data;
- #define DEFAULT_TYPE 0
- #define TEXT_CONTENTS 1
- /*}}} */
-
- typedef struct element
- { int lineflags;
- union
- { unsigned char *dat;
- # ifdef VIRTUAL
- int posi;
- # endif
- } datas;
- struct element *prec, *next;
- int indent;
- union
- { fold_data fold;
- unsigned char txt[sizeof(fold_data)];
- } x;
- } element;
-
- /*{{{ flag access*/
- # define set_lflags(e,t,h) ((e).lineflags=((int)(t)|(int)(h)))
- # define set_linetyp(e,t) set_lflags(e,t,no_highlight)
- # define get_linetyp(e) ((linetyp)(e).lineflags&FOLD_MASK)
- # define test_linetyp(e,t) ((e).lineflags&(t))
- # define get_highlight(e) ((highlight_typ)(e).lineflags&~FOLD_MASK)
- /*}}} */
- /*}}} */
- /*{{{ change_status*/
- typedef enum { unchanged_file=0,changed_once,changed_file } change_status;
- /*}}} */
- /*{{{ win_data*/
- typedef struct { int h;int w; } win_data;
- /*}}} */
- /*{{{ buffer_data*/
- /*{{{ select modes*/
- typedef enum
- { no_selection = 0,
- fold_selection = 1,
- lim_pseudo_fold_selection,
- lim_reg_selection,
- lim_block_selection,
- lim_nodrawn_selection,
- unmark_fold_selection,
- pseudo_fold_selection = -lim_pseudo_fold_selection,
- reg_selection = -lim_reg_selection,
- block_selection = -lim_block_selection,
- nodrawn_selection = -lim_nodrawn_selection
- } sel_mod;
- /*}}} */
- /*{{{ screen_data*/
- typedef struct
- { int list_no;
- int id;
- win_data off;
- win_data win;
- boolean clreol;
- boolean bold_stat;
- win_data txt_size;
- element *start;
- element *end;
- win_data cursor;
- int shift_size;
- int cur_shift_w;
- int full_shift_w;
- int end_level;
- # ifdef MULTIPLE_SCREEN
- MULTIPLE_SCREEN
- # endif
- } scr_dat;
- /*}}} */
- typedef struct
- { scr_dat scr;
- /*{{{ fold data*/
- struct
- { struct f_m_str
- { unsigned char txt[4][FOLD_TAG_LENGTH+1];
- int o_dsp_l;
- int l_dsp_l;
- # define close_f txt[0]
- # define file_f txt[1]
- # define line_f txt[2]
- # define open_f txt[3]
- } str;
- boolean count_comment_line;
- int entered;
- int enter_spaces;
- element *real_head;
- element *real_tail;
- element *head;
- element *tail;
- element *End_of_fold;
- element *Start_of_fold;
- element *Line_after_fold;
- element *current;
- linetyp cur_line_typ;
- element *select_ptr;
- } f;
- /*}}} */
- /*{{{ editing*/
- struct
- { int first_scr_e_pos;
- int pre_scr_e_pos;
- element *part_line;
- boolean split_line;
- boolean fold_in;
- int file_no;
- int makefold_indent;
- } e;
- /*}}} */
- /*{{{ mode data*/
- struct
- { sel_mod select_mode;
- boolean last_no_sel;
- boolean upd_sel_delayed;
- boolean full_shift;
- boolean hash_shift;
- boolean overwrite;
- boolean read_only;
- boolean user_view;
- change_status file_changed_status;
- boolean dir_edit;
- struct lg_dumb
- { f_c_types typ;
- struct dia_lg lg;
- unsigned char lg_u_s[FOLD_COMMENT_LENGTH+1];
- unsigned char lg_u_e[FOLD_COMMENT_LENGTH+1];
- } dialect;
- } m;
- /*}}} */
- /*{{{ statusline*/
- struct
- { int last_x_pos;
- int y_pos;
- } S;
- /*}}} */
- } buffer_data;
- /*}}} */
- /*{{{ mouse_typ*/
- #ifdef MOUSY
- typedef enum
- { no_mouse=0 /* not using a mouse */
- # ifdef XTERM
- ,xterm /* using the xterm mouse-support */
- # endif
- # ifdef MGR
- ,mgr /* using the mgr mouse-support */
- # endif
- # ifdef OS_MOUSE_TAG
- ,OS_MOUSE_TAG /* this is maybe defined for os-specific mouse */
- # endif
- ,mouse_supports /* this entry can be used to get the number of */
- /* known mice, it's no real mouse-support! */
- } mouse_typ;
- #endif
- /*}}} */
- /*{{{ reg_types*/
- #ifdef REGEXP
- typedef enum { no_reg,basic_reg,ext_reg } reg_types;
- # endif
- /*}}} */
- /*}}} */
-
- /*{{{ malloc functions*/
- #ifndef MALLOC_DEBUG
- # define paket_realloc(p,x) ORIrealloc(p,x)
- # define paket_malloc(x) ORImalloc(x)
- # define paket_free(x) ORIfree(x)
- #else
- # define DEBUGGING
- extern void *paket_malloc(size_t);
- extern void *paket_realloc(void*,size_t);
- extern void paket_free(void*);
- #endif
- /*}}} */
- /*{{{ debug functions*/
- /*{{{ ocl debug functions*/
- #ifdef OCL_DEBUG
- # ifndef DEBUGGING
- # define DEBUGGING
- # endif
- extern void ocl_key(int);
- extern void ocl_msg(char*,int);
- extern void ocl_debug(int,TOKEN);
- extern void ocl_get_arg_dbg(TOKEN a,char *s);
- #else
- # define ocl_key(k)
- # define ocl_msg(s,n)
- # define ocl_debug(x,y)
- # define ocl_get_arg_dbg(a,s)
- #endif
- /*}}} */
- /*{{{ virtual debug functions*/
- #ifdef VIR_DEBUG
- # ifndef DEBUGGING
- # define DEBUGGING
- # endif
- extern void vir_debug(off_t);
- #else
- # define vir_debug(x)
- #endif
- /*}}} */
- /*{{{ specify global debug functions*/
- #ifdef DEBUGGING
- extern void start_debug(void);
- extern void end_debug(void);
- extern void arg_debug(char*);
- extern void title_debug(unsigned char*);
- # define DEBUG_FEATURE "@"
- # ifndef DEBUG_FILE
- # define DEBUG_FILE "oridebug.dat"
- # endif
- #else
- # define start_debug()
- # define end_debug()
- # define arg_debug(x)
- # define title_debug(x)
- # define DEBUG_FEATURE ""
- #endif
- /*}}} */
- /*}}} */
-
- /*{{{ STRING_C*/
- #if defined(STRING_C) || defined(I_STRING_C)
- # ifdef I_STRING_C
- # undef I_STRING_C
- # endif
- # ifdef REGEXP
- # define re_args(x) ,x
- extern boolean preg_ok;
- extern unsigned char *reg_ustrstr(unsigned char*,boolean,boolean);
- # else
- # define re_args(x)
- # define get_search(x,y,z) get_search_string()
- # endif
- extern int get_search(boolean,boolean,boolean);
- extern unsigned char *strsub(unsigned char const*, int);
- extern int proc_replace(int,unsigned char const*const,unsigned char*,int,int);
- extern char *do_file_c(char *f);
- #endif
- /*}}} */
- /*{{{ BUFFLOOP_C*/
- #if defined(BUFFLOOP_C) || defined(I_BUFFLOOP_C)
- # ifdef I_BUFFLOOP_C
- # undef I_BUFFLOOP_C
- # endif
- extern void try_unchange(void);
- extern TOKEN buffer_loop(TOKEN,boolean);
- extern element *deleted_lines[UNDEL_LINES];
- extern int delete_ptr;
- # ifdef REGEXP
- extern reg_types reg_type;
- # endif
- #endif
- /*}}} */
- /*{{{ DISPLAY_C*/
- #if defined(DISPLAY_C) || defined(I_DISPLAY_C)
- # ifndef I_MAIN_C
- # define I_MAIN_C
- # endif
- # define warn_delay() usleep(verbose?(unsigned long)800000L:(unsigned long)400000L)
- #endif
- #if defined(DISPLAY_C) || defined(I_DISPLAY_C)
- # ifdef I_DISPLAY_C
- # undef I_DISPLAY_C
- # endif
- /*{{{ highlight_typ*/
- typedef enum
- { no_highlight =0,
- full_highlight=1<<FOLD_BITS,
- m_f_highlight =2<<FOLD_BITS,
- f_m_highlight =3<<FOLD_BITS,
- c_m_highlight =4<<FOLD_BITS,
- c_f_highlight =5<<FOLD_BITS
- } highlight_typ;
- /*}}} */
- /*{{{ dsp_data*/
- typedef struct dsp_modes
- { int tab_size;
- enum dsp_size
- { tab_dsp = -2,
- ictrl_dsp = -1,
- norm_dsp = 1,
- mark_dsp = 2,
- hex_dsp = 3,
- oct_dsp = 4,
- dec_dsp = 5,
- max_dsp
- } base,ctrl,norm,tilde,high;
- int ctrl_add;
- } dsp_data;
- /*}}} */
- /*{{{ TITLE_OP*/
- typedef enum
- { UPDTITLE=0,
- PRTTITLE,
- CHGTITLE,
- SMALLTITLE,
- # ifdef WINDOW_TITLE_CHANGE
- WINTITLE,
- # endif
- CHGX,
- CHGXY,
- INCY,
- DECY,
- LINE_NO
- } TITLE_OP;
- /*}}} */
- # define numb_dsp(x) ((x)>mark_dsp)
- extern int on_screen(element const * const);
- extern void chg_dsp_type(int);
- extern enum dsp_size char_dsp_size(unsigned char const);
- # define CHAR_DSP_SIZE(c) \
- ( ((unsigned int)c>=' ' && (unsigned int)c<127 && c!=(unsigned char)'~') \
- ? dsp.norm : char_dsp_size(c) \
- )
- extern int txt2scr(int,int,unsigned char const*);
- extern int scr2txt(int,int,unsigned char const*);
- extern void x_shift(int*const,int*const,int,int,int,unsigned char const*);
- extern void clrbuffline(int,int);
- extern int prt_bin_text(int,int,boolean,unsigned char *);
- extern int prt_highlight_bin_text(int,int,int,int,boolean,unsigned char *);
- extern void move_prt_clreol(int,int,int,int,boolean,unsigned char *);
- extern void write_dsp_line(element const*const,int);
- extern int title_op(TITLE_OP);
- extern void restore_area(void);
- extern void set_area(int);
- extern void write_area(int,int,unsigned char const*);
- extern void restore(int);
- extern void restore_to_end(int);
- extern void restore_element(int);
- extern void restore_or_restore_to_end(void);
- extern boolean restore_shift(int);
- extern void up_a_bit(int);
- extern void down_a_bit(int);
- extern void whole_screen_up(void);
- extern void whole_screen_down(void);
- extern boolean upd_highlight(element*,element*,boolean);
- extern unsigned char *u_modes[MODE_COUNT*2];
- extern int n_modes[MODE_COUNT];
- extern boolean um_active[MODE_COUNT];
- extern int message_line;
- extern win_data area_line;
- extern int area_used;
- extern dsp_data dsp;
- extern boolean dirty;
- extern boolean xy_show;
- extern boolean allow_text_so;
- extern unsigned char *w_name;
- extern unsigned char print_buffer[BUFFERLEN+1];
- #ifdef WINDOW_TITLE_CHANGE
- extern unsigned char statline[BUFFERLEN+1];
- #endif
- #endif
- /*}}} */
- /*{{{ FIELDEDIT_C*/
- #if defined(FIELDEDIT_C) || defined(I_FIELDEDIT_C)
- # ifdef I_FIELDEDIT_C
- # undef I_FIELDEDIT_C
- # endif
- extern void move_cursor(int);
- extern void restore_cursor_and_sleep(int);
- extern TOKEN field_edit(void);
- extern unsigned char deleted_ch;
- extern void do_cc_compare(unsigned char const,TOKEN const);
- extern void do_str_compare(unsigned char const * const);
- #endif
- /*}}} */
- /*{{{ FILEC*/
- #if defined(FILEC_C) || defined(I_FILEC_C)
- # ifdef I_FILEC_C
- # undef I_FILEC_C
- # endif
- extern char *filec(char*);
- #endif
- /*}}} */
- /*{{{ FINDS_C*/
- #if defined(FINDS_C) || defined(I_FINDS_C)
- # ifdef I_FINDS_C
- # undef I_FINDS_C
- # endif
- extern int line_no(element const*,element const*const);
- extern int cur_line_no(void);
- extern void close_and_open_folds(element*const);
- extern void find_element(int, int);
- extern boolean find_item(boolean,boolean,boolean re_args(reg_types));
- extern element *pre_find_element(int);
- extern void goto_line(int,element*,boolean);
- extern void query_replace(boolean);
- extern void do_replace(void);
- extern void its_search(boolean);
- extern unsigned char item_to_look_for[LINELEN+1];
- # ifdef REGEXP
- extern boolean inverted_search;
- # endif
- #endif
- /*}}} */
- /*{{{ FOLDFILING_C*/
- #if defined(FOLDFILING_C) || defined(I_FOLDFILING_C)
- # ifdef I_FOLDFILING_C
- # undef I_FOLDFILING_C
- # endif
- extern void save_lang(struct lg_dumb*const);
- extern void reset_lang(struct lg_dumb*const);
- extern void proc_language(void);
- extern void file_fold(unsigned char const*const,FILE*const);
- extern void attach_file(void);
- extern void filter_op(boolean);
- extern void pipe_from_command(void);
- extern void pipe_to_command(void);
- extern char *dump_file(void);
- extern void save_file(boolean const);
- extern void auto_write(void);
- extern int add_edit_file(char const*const,int,boolean);
- extern unsigned char const *fileno2name(int);
- extern void gen_arg_list(element*,element*);
- extern void open_arg_list(void);
- extern void open_file(boolean const);
- extern void open_list_file(void);
- extern void enter_list_file(void);
- extern void write_file(void);
- #endif
- /*}}} */
- /*{{{ FOLDHELP_C*/
- #if defined(FOLDHELP_C) || defined(I_FOLDHELP_C)
- # ifdef I_FOLDHELP_C
- # undef I_FOLDHELP_C
- # endif
- extern void check_fold(element*const);
- extern int to_start(int const);
- extern int to_bottom(int const);
- extern void skip_to(element*const);
- extern void move_down(void);
- extern void move_up(void);
- extern void undel_before(element*const);
- extern void append_to_pick(element*const);
- extern void undel_pick_before(void);
- extern void undel_after(element*const);
- extern void pre_remove_line(element**const);
- #endif
- /*}}} */
- /*{{{ FOLDING_C*/
- #if defined(FOLDING_C) || defined(I_FOLDING_C)
- # ifdef I_FOLDING_C
- # undef I_FOLDING_C
- # endif
- extern boolean normal_att(fold_data const*const,boolean);
- extern void insert_link_before(element*const);
- extern element *copy_a_line(void);
- extern boolean chg_foldtype(int const,int const);
- extern void start_make_fold(sel_mod);
- extern void make_fold(void);
- extern void remove_line(element**const);
- extern void delete_list(element*,element*const);
- extern void pre_exit_fold(void);
- extern void pre_top_fold(void);
- extern void pre_open_fold(element*const);
- extern void enter_fold(unsigned char const*const);
- extern void exit_fold(void);
- extern void open_fold(void);
- extern void close_fold(void);
- extern void unfold(void);
- extern void create_list(void);
- extern void chg_marks(void);
- extern element *pick_head;
- extern element *pick_tail;
- extern unsigned char cur_dsp_line[LINELEN+1];
- #endif
- /*}}} */
- /*{{{ GETMSG_C*/
- #if defined(GETMSG_C) || defined(I_GETMSG_C)
- # ifdef I_GETMSG_C
- # undef I_GETMSG_C
- # endif
- extern unsigned char *i_to_ua(int);
- extern unsigned char *get_msg(msgtyp,...);
- extern int msg_file;
- extern unsigned char **rc_msg;
- extern int rc_msg_count;
- extern msgtyp last_message;
- #endif
- /*}}} */
- /*{{{ GETTK_C*/
- #if defined(GETTK_C) || defined(I_GETTK_C)
- # define cy_ind (a_f_mac[1])
- # ifndef OCL_DEBUG
- # define get_arg(s) get_argument()
- # define get_arg_fixed(c,s) get_argument_fixed(c)
- # endif
- #endif
- #if defined(GETTK_C) || defined(I_GETTK_C)
- # ifdef I_GETTK_C
- # undef I_GETTK_C
- # endif
- /*{{{ macro_entry*/
- typedef struct
- { enum { load=0,loaded,init,def } mode;
- union { TOKEN const *txt;off_t off; } mac;
- } macro_entry;
- /*}}} */
- /*{{{ stackent*/
- typedef union { TOKEN const *tp;int v;element *l; } stackent;
- /*}}} */
- extern void ori_abort(int sig);
- extern void stop_macros(boolean);
- extern boolean push_macro(TOKEN const*const);
- extern TOKEN const *push_str_macro(unsigned char const*);
- extern void auto_flush(void);
- # ifndef OCL_DEBUG
- extern TOKEN get_argument(void);
- extern TOKEN get_argument_fixed(int);
- # else
- extern TOKEN get_arg(char const*const);
- extern TOKEN get_arg_fixed(int,char const*const);
- # endif
- extern void call_number_macro(int);
- extern void prompt_string(unsigned char*);
- extern TOKEN hide_key(void);
- extern TOKEN edit_key(void);
- extern TOKEN const empty_macro[];
- extern TOKEN a_f_mac[];
- extern int bind_const[RCC_SIZE];
- extern macro_entry const *fix_macros;
- extern boolean macro_tag;
- extern boolean run_abort_mac;
- extern stackent *ocl_var;
- extern int executing_macro;
- extern boolean defining_macro;
- extern int scr_off;
- #endif
- /*}}} */
- /*{{{ INIT_C*/
- #if defined(INIT_C) || defined(I_INIT_C)
- # ifdef I_INIT_C
- # undef I_INIT_C
- # endif
- extern char *open_sysfile(char const*const,char*const);
- extern boolean rcfileparser(char[NO_OCL_CMD_OPTS*(2*BIND_NAME_LEN+2)],char*);
- extern TOKEN const *load_demand(int const);
- extern void unload_demand(int const);
- extern void HostBegin(char*);
- extern void initialise(void);
- extern void rcclose(void);
- extern FILE *rcfile;
- extern char *ori_name;
- # ifdef NOMEMDUMP
- extern char *mem_dump_malloc;
- # endif
- extern off_t helpofs;
- extern off_t compofs;
- extern char const *ori_path;
- #endif
- /*}}} */
- /*{{{ KEYBOARD_C*/
- #if defined(KEYBOARD_C) || defined(I_KEYBOARD_C)
- # ifdef I_KEYBOARD_C
- # undef I_KEYBOARD_C
- # endif
- extern void enable_echo(boolean const);
- extern void switch_echo(boolean const);
- extern void enable_abort(void);
- extern void disable_abort(void);
- extern void init_keyboard(void);
- extern void reset_keyboard(void);
- # ifdef WINDOW_TITLE_CHANGE
- extern void chg_w_title(char const*);
- # endif
- extern void read_err(FILE * const f,char * const s);
- extern TOKEN get_key(void);
- extern FILE *kbd_file;
- extern boolean echo_disabled;
- extern boolean echo_active;
- extern boolean eight_bits;
- # ifdef WINDOW_TITLE_CHANGE
- extern char *w_title;
- extern int wt_buff_id;
- # endif
- # ifdef MOUSY
- extern mouse_typ use_mouse;
- extern const int mouse_b_count[mouse_supports];
- extern char const * const * const mouse_b_names[mouse_supports];
- # endif
- #endif
- /*}}} */
- /*{{{ KEYTAB_C*/
- #if defined(KEYTAB_C) || defined(I_KEYTAB_C)
- # ifdef I_KEYTAB_C
- # undef I_KEYTAB_C
- # endif
- extern void kbd_change(int const);
- # ifdef INIT_C
- extern void set_key_top(KEY const*const,int const*const);
- # endif
- extern int find_key(int const);
- extern boolean valid_key(TOKEN const);
- extern boolean valid_field_key(TOKEN const);
- extern int valid_screen_key(TOKEN const);
- extern boolean invalid_prompt_key(TOKEN const);
- # ifdef MOUSY
- extern TOKEN handle_click(int const,int const,int const);
- # endif
- extern int curr_kbd;
- # ifdef MOUSY
- extern TOKEN *mouse_mapping;
- # endif
- extern int const *bind_mark;
- extern boolean quote_used;
- extern int mouse_number;
- #endif
- /*}}} */
- /*{{{ LOOP_C*/
- #if defined(LOOP_C) || defined(I_LOOP_C)
- # ifdef I_LOOP_C
- # undef I_LOOP_C
- # endif
- extern void warn_mult_edit(void);
- extern RETURNS main_editor_loop(void);
- extern int decode_buffer_mouse(int const,int const,boolean const);
- extern void mail_and_dump(int);
- extern unsigned char line_buffer[LINELEN+1];
- extern FILE *start_pipe;
- extern boolean running;
- extern buffer_data bd;
- extern buffer_data init_buffer;
- extern int buff_used;
- extern int mult_edit;
- extern win_data root_dont_use;
- extern int startup_line;
- extern boolean no_fold_out;
- #endif
- /*}}} */
- /*{{{ MAIN_C*/
- #if defined(MAIN_C) || defined(I_MAIN_C)
- # ifdef I_MAIN_C
- # undef I_MAIN_C
- # endif
- extern char kp_state;
- extern char const *rc_name;
- extern unsigned char const *filearg;
- extern boolean auto_save;
- extern TOKEN sig_macro[HISTORY_SIZE+1];
- extern int sig_count;
- extern boolean verbose;
- extern boolean aborted;
- # if defined(SIGWINCH) || defined(MGR)
- extern boolean win_changed;
- # endif
- extern boolean interrupt_restore;
- extern element null_element;
- extern language_comment dialects[F_C_SIZE];
- extern boolean no_suspend;
- extern boolean no_pipe;
- #endif
- /*}}} */
- /*{{{ MESSAGES_C*/
- #if defined(MESSAGES_C) || defined(I_MESSAGES_C)
- # ifdef I_MESSAGES_C
- # undef I_MESSAGES_C
- # endif
- /*{{{ inputs*/
- extern unsigned char NO;
- extern unsigned char YES;
- extern unsigned char AB;
- extern unsigned char DO_AB;
- extern unsigned char DO_REST;
- /*}}} */
- /*{{{ not getmsg messages*/
- extern unsigned char origami_name[BIND_NAME_LEN+1];
- extern unsigned char const ctrl_decode[];
- extern unsigned char const hex_digits[];
- extern char const M_FM[];
- extern char const M_INV_OCL[];
- extern unsigned char const M_MIS_MES[];
- extern unsigned char const M_IN_MES[];
- extern unsigned char const M_NO_MEMORY[];
- extern unsigned char const M_NO_MALLOC[];
- extern unsigned char const M_INVALID_PATH[];
- /*}}} */
- /*{{{ parts of filenames*/
- extern unsigned char const M_CUT_PATH[];
- extern char const M_RCSTR[];
- extern char const M_MSGSTR[];
- extern char const M_HELPSTR[];
- /*}}} */
- /*{{{ code folds*/
- extern unsigned char const fold_f[];
- extern unsigned char const fold_a[];
- /*}}} */
- /*{{{ multiple used text*/
- extern unsigned char const question[];
- # if FOLD_TAG_LENGTH>=3
- extern const unsigned char pseudo_mark[];
- # define three_space (pseudo_mark+FOLD_TAG_LENGTH-3)
- # else
- extern const unsigned char three_space[];
- # define pseudo_mark (three_space+3-FOLD_TAG_LENGTH)
- # endif
- # define two_space (three_space+1)
- # define one_space (three_space+2)
- # define empty_text (three_space+3)
- extern unsigned char const M_PSTR[];
- /*}}} */
- /*{{{ paths*/
- # ifdef DOC_MSG
- extern char const M_DOC_PATH[];
- # endif
- extern char const M_RC_PATH[];
- /*}}} */
- /*{{{ missing functions*/
- # ifndef REGEXP
- extern unsigned char const M_NOT_HERE[];
- # endif
- /*}}} */
- # ifndef NO_MSG
- extern boolean copyright;
- # endif
- /*{{{ copyright/usage string access*/
- extern unsigned char const *get_copyright(boolean);
- extern unsigned char const *get_long_usage(void);
- extern unsigned char const M_S_USAGE[];
- # define get_short_usage() M_S_USAGE
- /*}}} */
- #endif
- /*}}} */
- /*{{{ MISC_C*/
- #if defined(MISC_C) || defined(I_MISC_C)
- # ifdef I_MISC_C
- # undef I_MISC_C
- # endif
- extern unsigned char *fileprompt(unsigned char * const);
- extern void put_vars(void);
- extern void ocl_screen_off(void);
- extern boolean ocl_screen_on(void);
- #endif
- /*}}} */
- /*{{{ ORIEDT_C*/
- #if defined(ORIEDT_C) || defined(I_ORIEDT_C)
- # ifdef I_ORIEDT_C
- # undef I_ORIEDT_C
- # endif
- extern void *ori_malloc(size_t);
- extern void spaces(unsigned char*, int);
- extern void proc_dispose(element*const);
- extern void trailing_spaces(unsigned char*);
- extern void join_links(element*const,element*const);
- extern element *move_on(element const*);
- extern void close_fold_at(element*const);
- extern element *proc_new_element(void);
- extern void set_fold_mark_dsp_length(struct f_m_str*const);
- extern void proc_to_edit_pos(void);
- extern void proc_from_edit_pos(void);
- extern void copyin(unsigned char*const,const element*const,const boolean);
- extern void copyout(unsigned char const*const, element*const);
- #endif
- /*}}} */
- /*{{{ PROMPT_C*/
- #if defined(I_PROMPT_C) || defined(PROMPT_C)
- # define START_HISTORY_INDEX -1
- # define HISTORY_ADD_OLD 1
- # define HISTORY_ADD_NEW -1
- # define s_readprompt(s,p,l,h) readprompt((s),(p),(l),(h),(unsigned char*)0,0)
- #endif
- #if defined(PROMPT_C) || defined(I_PROMPT_C)
- # ifdef I_PROMPT_C
- # undef I_PROMPT_C
- # endif
- extern histories overwrite_history_id;
- extern void shrink_history(void);
- extern void add_history(histories const,unsigned char const*const);
- extern void access_history
- ( int,
- histories,
- boolean,
- int*const,
- unsigned char**const
- );
- extern boolean show_string(unsigned char const*,boolean const);
- extern void help(boolean);
- extern void readprompt
- ( unsigned char*const,
- unsigned char const*const,
- int const,
- histories const,
- unsigned char const*const,
- int
- );
- extern int menu_item(unsigned char const*,int,boolean const,boolean const);
- extern boolean yes(unsigned char const*const);
- extern void message(unsigned char const*const);
- extern void msg_message(msgtyp);
- extern void verbose_msg_message(msgtyp);
- extern void err_message(msgtyp,unsigned char const*const);
- extern void warn_message(unsigned char const*const);
- extern void no_message(void);
- extern unsigned char const *menu_string;
- extern int menu_current;
- extern int prompt_shift_size;
- #endif
- /*}}} */
- /*{{{ SCREEN_C*/
- #ifdef I_SCREEN_C
- # undef I_SCREEN_C
- /*{{{ SCR_BUFF stuff, link screen access to buffer*/
- # if defined(USE_SCRBUFF) && !defined(SCRBUFF_C)
- /*{{{ define screen functions ??? to scrbuff functions B_???*/
- /*{{{ oputs*/
- # ifdef oputs
- # undef oputs
- # endif
- # define oputs B_oputs
- extern void B_oputs(unsigned char*);
- /*}}} */
- /*{{{ oputc*/
- # ifdef oputc
- # undef oputc
- # endif
- # define oputc B_oputc
- extern void oputc(int);
- /*}}} */
- /*{{{ oflush*/
- # ifdef oflush
- # undef oflush
- # endif
- # define oflush B_oflush()
- extern void B_oflush(void);
- /*}}} */
- /*{{{ move_cursor_to*/
- # ifdef move_cursor_to
- # undef move_cursor_to
- # endif
- # define move_cursor_to B_move_cursor_to
- /*}}} */
- /*{{{ moveclreol*/
- # ifdef moveclreol
- # undef moveclreol
- # endif
- # define moveclreol B_moveclreol
- /*}}} */
- /*{{{ ClrScr*/
- # ifdef ClrScr
- # undef ClrScr
- # endif
- # define ClrScr B_ClrScr
- /*}}} */
- /*{{{ insLine*/
- # ifdef insLine
- # undef insLine
- # endif
- # define insLine B_insLine
- /*}}} */
- /*{{{ DelLine*/
- # ifdef DelLine
- # undef DelLine
- # endif
- # define DelLine B_DelLine
- /*}}} */
- /*{{{ do_standout*/
- # ifdef do_standout
- # undef do_standout
- # endif
- # define do_standout B_do_standout
- /*}}} */
- /*{{{ do_standend*/
- # ifdef do_standend
- # undef do_standend
- # endif
- # define do_standend B_do_standend
- /*}}} */
- /*{{{ init_terminal*/
- # ifdef init_terminal
- # undef init_terminal
- # endif
- # define init_terminal B_init_terminal
- /*}}} */
- /*{{{ reset_terminal*/
- # ifdef reset_terminal
- # undef reset_terminal
- # endif
- # define reset_terminal B_reset_terminal
- /*}}} */
- /*{{{ get_terminal_capability*/
- # ifdef get_terminal_capability
- # undef get_terminal_capability
- # endif
- # define get_terminal_capability B_get_terminal_capability
- /*}}} */
- /*{{{ xs*/
- # ifdef xs
- # undef xs
- # endif
- # define xs B_xs
- /*}}} */
- /* bell,bell_visible,screen_off,screen_on are used directly! */
- /*}}} */
- extern void B_invalid(void);
- extern void B_valid(void);
- # endif
- # ifdef USE_SCRBUFF
- # ifndef BLOCK_FLUSH
- extern void step_or_move_cursor(int,int,int,int);
- extern void insChar(unsigned char*,int);
- extern void delChar(int);
- extern int moputc(int,int);
- extern boolean use_shift;
- extern boolean mi;
- # else
- # define use_shift FALSE
- # define step_or_move_cursor(y,x,dy,dx) move_cursor_to(y,x)
- # endif
- extern void scr_cursor(boolean);
- extern boolean B_scroll_region(int,int,int,int,boolean);
- # ifdef EXT_SCRBUFF_ACCESS
- extern unsigned char cur_scr_char(int,int);
- # endif
- extern boolean am;
- extern char const *ce;
- # else
- # define B_invalid() 0
- # define B_valid() 0
- # define B_scroll_region(y1,x1,y2,x2,up) TRUE
- # endif
- /*}}} */
- extern void move_cursor_to(int,int);
- extern void moveclreol(int,int);
- extern void ClrScr(void);
- extern boolean insLine(int);
- extern boolean DelLine(int);
- extern void do_standout(void);
- extern void do_standend(void);
- extern void init_terminal(void);
- extern void reset_terminal(void);
- extern void bell_visible(void);
- extern void bell_audible(void);
- extern void send_terminal(int);
- # define send_s_terminal(s) \
- do { unsigned char *p;for (p=(s);*p;send_terminal(*p++));} while(NEVER)
- extern void flush_terminal(void);
- extern boolean check_terminal(char const * const);
- extern void screen_off(void);
- extern void screen_on(void);
- extern int get_terminal_capability(void);
- extern char const *terminal;
- extern FILE *scrout;
- extern char const *al;
- extern char const *dl;
- extern boolean xs;
- extern boolean xt;
- extern boolean hz;
- extern int sg;
- extern char const *so;
- extern win_data screen;
- #endif
- /*}}} */
- /*{{{ SET_C*/
- #if defined(SET_C) || defined(I_SET_C)
- # ifdef I_SET_C
- # undef I_SET_C
- # endif
- # if defined(SET_C) || defined(FIELDEDIT_C)
- extern boolean test_char_set(int,SetId);
- # endif
- extern void set_copy(int,int);
- extern boolean init_set(void);
- #endif
- /*}}} */
- /*{{{ SHELL_C*/
- #if defined(SHELL_C) || defined(I_SHELL_C)
- # ifdef I_SHELL_C
- # undef I_SHELL_C
- # endif
- extern int subshell(const char*const);
- extern FILE *open_shell(const char*const,const char*const);
- extern int close_shell(FILE*);
- extern boolean force_sh;
- extern boolean secure;
- extern char const *shell_name;
- #endif
- /*}}} */
- /*{{{ SIGNALS_C*/
- #if defined(SIGNALS_C) || defined(I_SIGNALS_C)
- # ifdef I_SIGNALS_C
- # undef I_SIGNALS_C
- # endif
- extern void exit_origami(RETURNS,unsigned char const*);
- extern void check_time_event(void);
- extern void init_signals(void);
- extern int switch_time(boolean);
- extern void set_alarm(int,boolean);
- extern void reset_alarm(void);
- extern void suspend(void);
- extern int alarm_time;
- extern char time_str[];
- extern boolean do_dump;
- # ifdef USE_SCRBUFF
- extern boolean redraw_on_sig;
- #else
- # define redraw_on_sig True
- # endif
- #endif
- #ifdef SIGNALS_C
- # ifdef AUTOSAVE_FILE
- extern boolean autosave_done;
- # endif
- #endif
- /*}}} */
- /*{{{ READFOLDS_C*/
- #if defined(READFOLDS_C) || defined(I_READFOLDS_C)
- # ifdef I_READFOLDS_C
- # undef I_READFOLDS_C
- # endif
- extern void insert_file
- ( element const*const,
- element*const,
- element*const,
- boolean const,
- element const*const,
- boolean*const,
- boolean*const,
- FILE*const
- );
- extern struct f_sz { int c;int l; } file_io_size;
- #endif
- /*}}} */
- /*{{{ VIRTUAL_C*/
- #if defined(VIRTUAL_C) || defined(I_VIRTUAL_C)
- # ifdef I_VIRTUAL_C
- # undef I_VIRTUAL_C
- # endif
- # ifdef VIRTUAL
- extern int init_data_handle(void);
- extern int end_data_handle(void);
- # endif
- extern void set_data
- ( element *const,
- unsigned char const*const,
- boolean const txt
- );
- extern void set_0_data(element *const);
- # ifdef VIRTUAL
- extern unsigned char *get_data(element const*const);
- extern void new_data(element*);
- extern int vir_nodes;
- # else
- # define get_data(p) (p)->datas.dat
- # define new_data(p) (p)->datas.dat=(unsigned char*)empty_text
- # endif
- #endif
- /*}}} */
- /*{{{ WRITEFOLDS_C*/
- #if defined(WRITEF_C) || defined(I_WRITEF_C)
- # ifdef I_WRITEF_C
- # undef I_WRITEF_C
- # endif
- extern boolean write_fold(unsigned char const*const,element const*const,FILE*const);
- extern void total_save(FILE*const);
- extern int current_ind;
- #endif
- /*}}} */
-